package cn.stylefeng.guns.config.redis;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * Redis配置文件
 * Created by L on 2017/3/1.
 */
@Component
@ConfigurationProperties(prefix = "global.redis")
public class GlobalRedisConfig {

    private String hostName;
    private String redisPort;
    private String redisPasswod;
    private String dataBase;
    private String dataBase0;
    private String dataBase1;
    private String dataBase2;
    private String dataBase3;
    private String dataBase4;
    private String dataBase5;

    private int maxActive;
    private long maxWait;
    private int maxIdle;
    private int minIdle;
    private long  minTimeMillis;
    private int numTestsPerEvictionRun;
    private long timeBetweenEvictionRunsMillis;

    public String getHostName() {
        return hostName;
    }

    public void setHostName(String hostName) {
        this.hostName = hostName;
    }

    public int getRedisPort() {
        try{
            return Integer.parseInt(redisPort);
        }catch (Exception e){
            return 6379;
        }
    }

    public void setRedisPort(String redisPort) {
        this.redisPort = redisPort;
    }

    public String getRedisPasswod() {
        return redisPasswod;
    }

    public void setRedisPasswod(String redisPasswod) {
        this.redisPasswod = redisPasswod;
    }

    public int getDataBase() {
        try{
            return Integer.parseInt(dataBase);
        }catch (Exception e){
            return 0;
        }
    }

    public void setDataBase(String dataBase) {
        this.dataBase = dataBase;
    }

    public int getMaxActive() {
        return maxActive;
    }

    public void setMaxActive(int maxActive) {
        this.maxActive = maxActive;
    }

    public long getMaxWait() {
        return maxWait;
    }

    public void setMaxWait(long maxWait) {
        this.maxWait = maxWait;
    }

    public int getMaxIdle() {
        return maxIdle;
    }

    public void setMaxIdle(int maxIdle) {
        this.maxIdle = maxIdle;
    }

    public int getMinIdle() {
        return minIdle;
    }

    public void setMinIdle(int minIdle) {
        this.minIdle = minIdle;
    }

    public long getMinTimeMillis() {
        return minTimeMillis;
    }

    public void setMinTimeMillis(long minTimeMillis) {
        this.minTimeMillis = minTimeMillis;
    }

    public int getNumTestsPerEvictionRun() {
        return numTestsPerEvictionRun;
    }

    public void setNumTestsPerEvictionRun(int numTestsPerEvictionRun) {
        this.numTestsPerEvictionRun = numTestsPerEvictionRun;
    }

    public long getTimeBetweenEvictionRunsMillis() {
        return timeBetweenEvictionRunsMillis;
    }

    public void setTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis) {
        this.timeBetweenEvictionRunsMillis = timeBetweenEvictionRunsMillis;
    }

    public int getDataBase0() {
        try{
            return Integer.parseInt(dataBase0);
        }catch (Exception e){
            return 0;
        }
    }

    public void setDataBase0(String dataBase0) {
        this.dataBase0 = dataBase0;
    }

    public int getDataBase1() {
        try{
            return Integer.parseInt(dataBase1);
        }catch (Exception e){
            return 0;
        }
    }

    public void setDataBase1(String dataBase1) {
        this.dataBase1 = dataBase1;
    }

    public int getDataBase2() {
        try{
            return Integer.parseInt(dataBase2);
        }catch (Exception e){
            return 0;
        }
    }

    public void setDataBase2(String dataBase2) {
        this.dataBase2 = dataBase2;
    }

    public int getDataBase3() {
        try{
            return Integer.parseInt(dataBase3);
        }catch (Exception e){
            return 0;
        }
    }

    public void setDataBase3(String dataBase3) {
        this.dataBase3 = dataBase3;
    }

    public int getDataBase4() {
        try{
            return Integer.parseInt(dataBase4);
        }catch (Exception e){
            return 0;
        }
    }

    public void setDataBase4(String dataBase4) {
        this.dataBase4 = dataBase4;
    }

    public int getDataBase5() {
        try{
            return Integer.parseInt(dataBase5);
        }catch (Exception e){
            return 0;
        }
    }

    public void setDataBase5(String dataBase5) {
        this.dataBase5 = dataBase5;
    }
}
